package com.jcourse.bookstore;

public class ForCourse {
	//100之间不能被3整除的数的和
	public static void main(String[] args) {
		int result1 = add(100);
		int result = factor(10);
		System.out.println("1-100之间能被3整除的数的和是："+result);
	}	
	static int add(int n) {
		int result1 = 0;	
		for(int i =0;i <= 100; i++) {
			boolean iszhengchu = (i%3 ) == 0;
			if(iszhengchu) {
				result1 += i;
			}
		}
		return result1;
	}
	//阶乘
	static int factor (int n) {
		int result =1;
		for(int i=1;i<=100;i++) {
			 result = result*i;
		}
		return result;
	}
    //例题
	static void scan(int n) {
		for(int i = 1;i <= n;i++) {
			if(condition(i)) {
				System.out.println(i + "符合条件");
			}
		}
	}
	static boolean condition(int n) {
		return n%3 == 1 && n%5 == 2 && n%7 == 3 && n%11 == 1;
	}
    
    //百钱买百鸡
    static void search() {
		for(int i = 0;i<=100;i++) {
			for(int j=1;j<=100;j++)
				for(int k=1;k<100;k++) {
					boolean c1=k%3 == 0;
					int cost=5*i+3*j+k/3;
					boolean c2=cost == 100;
					boolean c3 = i+j+k ==100;
					if(c1 && c2 && c3)
						System.out.println("公鸡：" +i+"母鸡："+j+"小鸡："+k);
				}
		}
	}
}
